﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SDF.Web.Models;


namespace SDF.Web
{
    public partial class exam_edit : SDF.Web.UI.Page
    {
        public AuthRule Model = new AuthRule();
        protected void Page_Load(object sender, EventArgs e)
        {

            //this.Model = db.FirstOrDefault<AuthRule>("where id=@0", Request["id"]);

            int id = Input.Get("id", 0);

            if (!db.Exists<AuthRule>(id))
            {
                lblMsg.Text = "记录不存在";
                return;
            }
            else
            {
                this.Model = db.Single<AuthRule>(id);
            }

            if (!IsPostBack)
            {
                txtTitle.Text = Model.Title;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.Title = txtTitle.Text;
            Model.Save();

            lblMsg.Text = DateTime.Now.ToString();
        }
    }
}